# 做AES解密，传入key，密文
def AES_Decrypt(key, data):
  # 设置初始化向量
  iv = '0102030405060708'
  # 转成bytes
  data = data.encode('utf8')
  # 对二进制bytes做base64的解码，解码后就是干净的密文的bytes
  encodebytes = base64.decodebytes(data)

  cipher = AES.new(key.encode('utf8'), AES.MODE_CBC, iv.encode('utf8'))
  text_decrypted = cipher.decrypt(encodebytes)
  def unpad(s): return s[0:-s[-1]]
  text_decrypted = unpad(text_decrypted)

  text_decrypted = text_decrypted.decode('utf8')
  return text_decrypted

